﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;

namespace FunArts.EasyDevOps.Shared.Models.SshClient.NginxClient
{
    public class NginxServerConfig
    {
        /// <summary>
        /// 监听端口号
        /// </summary>
        [Required(ErrorMessage = "监听端口是必需的")]
        [Range(1, 65535, ErrorMessage = "端口必须在1-65535之间")]
        public int ListenPort { get; set; } = 80;
        /// <summary>
        /// 服务器域名
        /// </summary>
        [Required(ErrorMessage = "名称是必须的")]
        public string ServerName { get; set; } = "";
        /// <summary>
        /// 前端项目根目录
        /// </summary>
        public string RootPath { get; set; }
        /// <summary>
        /// 默认索引文件
        /// </summary>
        public List<string> IndexFiles { get; set; } = new List<string> { "index.html", "index.htm" };
        /// <summary>
        /// Url处理规则
        /// </summary>
        public List<NginxServerConfigLocation> LocationList { get; set; }= new List<NginxServerConfigLocation>();
        /// <summary>
        /// 启用 HTTPS
        /// </summary>
        public bool EnableHttps { get; set; }
        /// <summary>
        /// SSL 证书路径
        /// </summary>
        public string SslCertificatePath { get; set; }
        /// <summary>
        /// SSL 证书密钥路径
        /// </summary>
        public string SslCertificateKeyPath { get; set; }
        /// <summary>
        /// 附加指令
        /// </summary>
        public List<string> AdditionalDirectives { get; set; } = new List<string>() { "try_files $uri $uri/ /index.html" };
    }
}
